package newtest;

import org.apache.http.HttpHost;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

/**
 * 对账 版本库：httpclient-4.4.1.jar fastjson-1.2.31.jar
 * 
 * @author zgh
 *
 */
public class CheckResultTask {
	static HttpHost target = null;
	static String httpProtocol = "http";
	static String insurer_username = "hd@123.com";//保险公司账号
	static String insurer_password = "45ffa8fa8f6e67b89b8804b9dc05be07";//保险公司密码
	static String ip = "127.0.0.1";
	static int port = 8080;
	static String bankCode="9111000010112001XW";//银行编码
	static String subBnkCode="110000";//监管辖区编码
	static String businessNo="";//业务识别号
	static String batchNo="20170911";//批次号

	public static void main(String[] args) throws Exception {
		CheckInsurer();
	}
	
	
	private static void CheckInsurer() throws IOException
	{
		CloseableHttpClient httpclient = InsurerTask.createSSLClientDefault();
		try {
			String url=httpProtocol + "://" + ip + ":" + port + "/checkResult_task?bankCode="+bankCode+"&subBankCode="+subBnkCode;
			if(!businessNo.isEmpty())
				url+="&businessNo="+businessNo;
			if(!batchNo.isEmpty())
				url+="&batchNo="+batchNo;
			HttpGet httpGet = new HttpGet(url);

			CloseableHttpResponse response = httpclient.execute(target, httpGet);
			try {
				System.out.println("----------------------------------------");
				System.out.println(response.getStatusLine());
				System.out.println(EntityUtils.toString(response.getEntity()));
			} finally {
				response.close();
			}
		} finally {
			httpclient.close();
		}
	}
}
